import React, { memo } from 'react'
import PropTypes from 'prop-types'

import RoomItem from '@/components/room-item'
import { RoomsWrapper } from './style'

const SectionRooms = memo(function SectionRooms(props) {
  const { roomList = [], itemwidth } = props

  return (
    <RoomsWrapper>
      {roomList?.slice(0, 8).map((item) => {
        return <RoomItem key={item.id} itemData={item} itemwidth={itemwidth} />
      })}
    </RoomsWrapper>
  )
})

SectionRooms.propTypes = {
  roomList: PropTypes.array,
}

export default SectionRooms
